import json
from rest_framework import serializers
from ..models.GlobalTables import LiteratureStatusType


# 用于输出查询时的数据


class LiterStatusListSerializer(serializers.ModelSerializer):
    display_str = serializers.SerializerMethodField()

    class Meta:
        model = LiteratureStatusType
        fields = ['uuid', 'display_str', "name", "zh_name"]
        
    def get_display_str(self, obj):
        return "{}({})".format(obj.zh_name, obj.name)
        
    @classmethod
    def get_extra_fields_info(self):
        return [{"title":"展示文本", "dataIndex":"display_str", "type":"CharField"}]